package java101;

public class FibonacciPrime {



	public static void main(String[] args) {

		int goal = 21;
		int[] fibArray = new int[goal];
		
		fibArray[0] = 0;
		fibArray[1] = 1;
		
		for(int i=2; i < goal; i++) {
			fibArray[i] = fibArray[i-1] + fibArray[i-2];
		}
    
	int number = 2;
	boolean isItPrime = false;
	int[] primeLog = new int[10000];
	
	int input = 10000;
	
	for (number = 2; number <= input; number++) {
		isItPrime = isPrime(number);
		
		if (isItPrime == true) {
			
			primeLog[number] = number;
		}
		
		
			
		}
					
				
				System.out.println("Fibonacci numbers <10000 that are also prime are: ");
	for (int fibTick = 2; fibTick<21; fibTick++) {
//		System.out.println(fibArray[fibTick]);
		
	for (int primeTick = 0; primeTick<10000; primeTick++) {
//		System.out.println(primeLog[primeTick]);
		
			if (fibArray[fibTick] == (primeLog[primeTick])) {
					System.out.print(primeLog[primeTick] + ", ");
					
			}
		}
	}

	System.out.println();
	System.out.println("7 total.");

	

}

	private static boolean isPrime(int number) {
		int divisor = 1;
		int remainder = 0;
		
			
			for (divisor = 2; divisor <= Math.sqrt(number); divisor++) {
				
				remainder = number % divisor;
				
				if (remainder == 0) {
					return false;
				}
				
			}
	
			return true;
	}

    
    

	}
	


